package com.yanqu.road.entity.tradewar;

import com.alibaba.fastjson.JSON;
import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.player.UserBaseInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class CrossUserTradeWarBattle extends DataObject {

	private long userId;

	private int activityId;

	private int battleType;

	private List<Integer> patronsList = new ArrayList<>();

	private int buyBuffTimes;

	private long enemyUserId;

	private UserBaseInfo enemyBaseInfo = new UserBaseInfo();

	private long enemyScore;

	private int useItemId;

	private String battleUid;

	private long modifyTime;

	private int enemyPatronsCount;

	private int fastTeamNum;

	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		if(this.userId != userId) {
			this.userId = userId;
			setUpdateOption();
		}
	}

	public int getActivityId() {
		return activityId;
	}

	public void setActivityId(int activityId) {
		if(this.activityId != activityId) {
			this.activityId = activityId;
			setUpdateOption();
		}
	}

	public int getBattleType() {
		return battleType;
	}

	public void setBattleType(int battleType) {
		if(this.battleType != battleType) {
			this.battleType = battleType;
			setUpdateOption();
		}
	}

	public List<Integer> getPatronsList() {
		return patronsList;
	}

	public void setPatronsList(List<Integer> patronsList) {
		if(null != patronsList) {
			this.patronsList = patronsList;
			setUpdateOption();
		}
	}

	public void addPatronsList(int patronsId) {
		if (!this.patronsList.contains(patronsId)) {
			this.patronsList.add(patronsId);
			setUpdateOption();
		}
	}

	public int getBuyBuffTimes() {
		return buyBuffTimes;
	}

	public void setBuyBuffTimes(int buyBuffTimes) {
		if(this.buyBuffTimes != buyBuffTimes) {
			this.buyBuffTimes = buyBuffTimes;
			setUpdateOption();
		}
	}

	public long getEnemyUserId() {
		return enemyUserId;
	}

	public void setEnemyUserId(long enemyUserId) {
		if(this.enemyUserId != enemyUserId) {
			this.enemyUserId = enemyUserId;
			setUpdateOption();
		}
	}

	public UserBaseInfo getEnemyBaseInfo() {
		return enemyBaseInfo;
	}

	public String getEnemyBaseInfoJsonStr(){
		if(null == enemyBaseInfo){
			return "{}";
		}else {
			return JSON.toJSONString(enemyBaseInfo);
		}
	}

	public void setEnemyBaseInfo(UserBaseInfo enemyBaseInfo) {
		this.enemyBaseInfo = enemyBaseInfo;
		setUpdateOption();
	}

	public long getEnemyScore() {
		return enemyScore;
	}

	public void setEnemyScore(long enemyScore) {
		if(this.enemyScore != enemyScore) {
			this.enemyScore = enemyScore;
			setUpdateOption();
		}
	}

	public int getUseItemId() {
		return useItemId;
	}

	public void setUseItemId(int useItemId) {
		if(this.useItemId != useItemId) {
			this.useItemId = useItemId;
			setUpdateOption();
		}
	}

	public String getBattleUid() {
		return battleUid;
	}

	public void setBattleUid(String battleUid) {
		if(!Objects.equals(this.battleUid, battleUid)) {
			this.battleUid = battleUid;
			setUpdateOption();
		}
	}

	public long getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(long modifyTime) {
		if(this.modifyTime != modifyTime) {
			this.modifyTime = modifyTime;
			setOp(DataStatus.Update);
		}
	}

	public int getEnemyPatronsCount() {
		return enemyPatronsCount;
	}

	public void setEnemyPatronsCount(int enemyPatronsCount) {
		if(this.enemyPatronsCount != enemyPatronsCount) {
			this.enemyPatronsCount = enemyPatronsCount;
			setUpdateOption();
		}
	}

	public int getFastTeamNum() {
		return fastTeamNum;
	}

	public void setFastTeamNum(int fastTeamNum) {
		if(this.fastTeamNum != fastTeamNum) {
			this.fastTeamNum = fastTeamNum;
			setUpdateOption();
		}
	}
}
